import request from '@/utils/request';

/**
 *  获取试用期列表
 * @param {*} data
 * @returns
 */
export const getAllAPI = ({ name, turned, rejected, delayed, page, limit }) => {
  return request({
    url: '/personnelManagement/probationReview/getAll',
    method: 'POST',
    data: {
      name,
      turned,
      rejected,
      delayed,
      page,
      limit,
    },
  });
};

/**
 *  删除试用期人员
 * @param {*} data
 * @returns
 */
export const deleteProbationReviewAPI = (probationId) => {
  return request({
    url: `/personnelManagement/probationReview/deleteProbationReview/${probationId}`,
    method: 'POST',
  });
};

/**
 *  修改试用期人员
 * @param {*} data
 * @returns
 */
// export const updateProbationStatusAPI = (probationId, probationStatus) => {
//   return request({
//     url: `/personnelManagement/probationReview/updateProbationStatus/${probationId}/${probationStatus}`,
//     method: 'POST',
//   });
// };
/**
 * Excel
 * @param {*} data
 * @returns
 */
export const exportExcelAPI = ({ name, page, limit, rejected, delayed, turned }) => {
  return request({
    url: '/personnelManagement/excel/exportToProbationReviewExcel',
    method: 'POST',
    responseType: 'blob',
    data: {
      name,
      page,
      limit,
      rejected,
      delayed,
      turned,
    },
  });
};

/**
 * Excel
 * @param {*} data
 * @returns
 */
export const updateProbationStatusAPI = ({ employeeId, employeeState }) => {
  return request({
    url: '/personnelManagement/probationReview/updateProbationStatus',
    method: 'POST',
    data: {
      employeeId,
      employeeState,
    },
  });
};
